renextop
.service('WeixinService',['$http','$q','CONFIG',function($http,$q,CONFIG){
	var syncserver = function(data){
		var deferred = $q.defer();
		$http({method:'GET',url:CONFIG.host+'/syncserver',params:data})
		.success(function(data,status,headers,config){
			deferred.resolve(data);
		})
		.error(function(data,status,headers,config){
			deferred.reject(data);
		});
		return deferred.promise;
	}

	var code2token = function(data){
		var deferred = $q.defer();
		$http({method:'GET',url:CONFIG.host+'/code2token',params:data})
		.success(function(data,status,headers,config){
			deferred.resolve(data);
		})
		.error(function(data,status,headers,config){
			deferred.reject(data);
		});
		return deferred.promise;
	}

	return {
		syncserver:syncserver,
		code2token:code2token
	}

}])
.service('ActivityService',['$http','$q','CONFIG',function($http,$q,CONFIG){
	var create = function(data){
		var deferred = $q.defer();
		$http({method:'post',url:CONFIG.host+'/activity/create',data:data})
		.success(function(data,status,headers,config){
			deferred.resolve(data);
		})
		.error(function(data,status,headers,config){
			deferred.reject(data);
		});
		return deferred.promise;
	}

	var helper = function(data){
		var deferred = $q.defer();
		$http({method:'post',url:CONFIG.host+'/activity/helper',data:data})
		.success(function(data,status,headers,config){
			deferred.resolve(data);
		})
		.error(function(data,status,headers,config){
			deferred.reject(data);
		});
		return deferred.promise;
	}

	var queryOne = function(data){
		var deferred = $q.defer();
		$http({method:'get',url:CONFIG.host+'/activity/queryOne',params:data})
		.success(function(data,status,headers,config){
			deferred.resolve(data);
		})
		.error(function(data,status,headers,config){
			deferred.reject(data);
		});
		return deferred.promise;
	}

	var queryFromUser = function(data){
		var deferred = $q.defer();
		$http({method:'get',url:CONFIG.host+'/activity/queryFromUser',params:data})
		.success(function(data,status,headers,config){
			deferred.resolve(data);
		})
		.error(function(data,status,headers,config){
			deferred.reject(data);
		});
		return deferred.promise;
	}

	return {
		create:create,
		helper:helper,
		queryOne:queryOne,
		queryFromUser:queryFromUser
	}

}])
.service('PrizeService',['$http','$q','CONFIG',function($http,$q,CONFIG){
	var query = function(data){
		var deferred = $q.defer();
		$http({method:'GET',url:CONFIG.host+'/prize/query',params:data})
		.success(function(data,status,headers,config){
			deferred.resolve(data);
		})
		.error(function(data,status,headers,config){
			deferred.reject(data);
		});
		return deferred.promise;
	}

	return {
		query:query
	}

}])